import { createContext, useMemo } from "react";
import Socket from "./index";

export const SocketContext = createContext(null);

const url="ws://192.168.3.12:8080";

export function SocketProvider({ children }) {
  const socket = useMemo(() => new Socket(url), []);

  return (
    <SocketContext.Provider value={socket}>
      {children}
    </SocketContext.Provider>
  );
}